<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <title>首页</title>
    <!-- Path to Framework7 Library CSS-->
    <link rel="stylesheet" href="css/framework7.ios.min.css">
    <link rel="stylesheet" href="css/framework7.ios.colors.min.css">
    <!-- Path to your custom app styles-->
    <link rel="stylesheet" href="css/my-app.css">
    <link rel="stylesheet" href="css/myPageCss/mypageCenter.css"/>
    <!--医生列表-->
    <link rel="stylesheet" href="css/index/index-2.css"/>

    <style type="text/css">
        body {
            background-color: white;
        }

        .icon-right {
            position: absolute;
            background: url(img/Right-Chevron.png) no-repeat right center transparent;
            background-size: 25px 25px;
            top: 7px;
            left: 7px;
            text-align: left;
            color: #fff;
            font-size: 18px;
        }
        .icon-top {
            top: 7px;
            border: none;
        }
        .top-item-text {
            margin: -5px auto;
            font-size: 13px;
            color: white;
        }

        .content-img {
            width: 28px;
            height: 28px;
            margin: 5px auto;
        }

        .content-text {
            margin: -5px auto;
            font-size: 11px;
            color: #333333;
        }

        .item-width-25 {
            width: 25%;
            height: 25%;
        }

        .item-width-50 {
            width: 50%;
        }

        .right-border {
            border-right: 1px solid #e6e6e6;
        }

        .bottom-border {
            border-bottom: 1px solid #e6e6e6;
        }

        /*轮播图*/
        .autoplay_news{float:left; position:relative; width:100%;top: 10px; overflow: hidden}
        .autoplay_news .auto_content_wrap{position:relative; overflow:hidden; width:100%; height:82px}
        .autoplay_news .auto_con{position:absolute; left:0; top:0; opacity:0; filter:alpha(opacity=0)}
        .autoplay_news img{display:block; float: left; width:100%; height:82px}
        .autoplay_news .curr_con{opacity:1; filter:alpha(opacity=100); z-index:5}
        .autoplay_news .auto_tab{position:absolute; left:0; bottom:0; z-index:6; width:100%; text-align:center}
        .autoplay_news .auto_tab span{display:inline-block; cursor:pointer; background:url(img/ico_autoTab.png) no-repeat; _background:url(img/ico_autoTab2.png) no-repeat; width:10px; height:10px; margin:0 5px; overflow:hidden}
        .autoplay_news .auto_tab .curr{background-position:0 -10px}
        /*轮播图*/
        .table{float:left; position:relative; width:100%;overflow: hidden}
        .table .auto_content_wrap_table{position:relative; overflow:hidden; width:100%; height:71px}
        .table .auto_con_table{position:absolute; left:0; top:0; opacity:0; filter:alpha(opacity=0)}
        .table img{display:block; width:100%; height:80px;
            float: left;}
        .table .curr_con_table{opacity:1; filter:alpha(opacity=100); z-index:5}
        .table .auto_tab_table{position:absolute; left:0; bottom:0; z-index:6; width:100%; text-align:center}
        /*.table .auto_tab_table span{display:inline-block; cursor:pointer; background:url(img/ico_autoTab.png) no-repeat; _background:url(img/ico_autoTab2.png) no-repeat; width:10px; height:10px; margin:0 5px; overflow:hidden}*/
        /*.table .auto_tab_table .curr_table{background-position:0 -10px}*/

        .section-btn {
            width: 67px;
            border: none;
            font-size: 13px;
            color: #333333;
        }
        .left-box {
            left: 15px;
        }
    </style>
</head>
<body>
<div class="views tabs toolbar-through">
    <!--导航条-->
    <div id="view-1" class="view view-main tab active">
        <div class="navbar">
            <div style="position: relative;width: 100%;height:137px;background: url(img/homeTopImg.png)">
                <!--地区-->
                <p class="icon-right button" style="border: none">北京&nbsp&nbsp&nbsp</p>
                <img src="img/dianhua.png" alt="耳机" class="button icon-top" id="callPhone" style="position: absolute;top: 7px;right: 7px"/>

                <img id="searchGo" src="img/Rounded-Magnifying-glass.png" alt="搜索" class="button icon-top" style="position: absolute;top: 7px;right: 50px"/>
                <table style="width: 100%;padding-top: 43px;text-align: center; background: url(img/homeTopImg.png)">
                    <tr id="top_list_content">
                    </tr>
                </table>
            </div>
        </div>
        <!-- Pages容器-->
        <div class="pages">
            <!-- Page, data-page contains page name-->
            <div data-page="index-1" class="page">
                <!-- Scrollable page content-->
                <div class="page-content" style="background-color: white;padding: 42px 0">
                    <table style="margin-top: 95px;width: 100%;text-align: center;border-collapse: collapse;border: 1px solid #e6e6e6">
                        <tr id="top-centent">
                        </tr>
                        <tr>
                            <td class="item-width-25 right-border bottom-border" >
                                <img src="img/hospital.png" alt="找医院" class="content-img" id="centent-content-img-1"/>
                                <p class="content-text" id="centent-content-text-1">床位手术</p>
                                <br/>
                            </td>
                            <td colspan="2" class="item-width-25 right-border bottom-border">
                                <div class="wrap cf">
                                    <!--轮播图-->
                                    <div class="table">
                                        <div class="auto_content_wrap_table" id="bannerImg_1">
                                            <!--<a class="auto_con_table" target="_blank"><img src="img/img1.jpg"></a>-->
                                            <!--<a class="auto_con_table" target="_blank"><img src="img/img1.jpg"></a>-->
                                            <!--<a class="auto_con_table" target="_blank"><img src="img/img1.jpg"></a>-->
                                            <!--<a class="auto_con_table" target="_blank"><img src="img/img1.jpg"></a>-->
                                        </div>
                                    </div>
                                    <!--轮播图-->
                                </div>
                            </td>
                            <td class="item-width-25 bottom-border" >
                                <img src="img/hospital.png" alt="找医院" class="content-img" id="centent-content-img-2"/>
                                <p class="content-text" id="centent-content-text-2">床位手术</p>
                                <br/>
                            </td>
                        </tr>
                        <tr id="bottom-centent">
                            <!--<td class="item-width-25 right-border bottom-border" >-->
                            <!--<img src="img/hospital.png" alt="找医院" class="content-img"/>-->
                            <!--<p class="content-text">床位手术</p>-->
                            <!--<br/>-->
                            <!--</td>-->
                        </tr>

                    </table>
                    <div class="wrap cf">
                        <!--轮播图-->
                        <div class="autoplay_news">
                            <div class="auto_content_wrap" id="bannerImage">
                                <!--<a class="auto_con" target="_blank"><img src="img/img1.jpg"></a>-->
                            </div>
                            <div class="auto_tab" id="bannerIcon">
                                <!--<span></span><span></span><span></span>-->
                            </div>
                        </div>
                        <!--轮播图-->
                    </div>
                    <!--常见科室-->
                    <div style="position: relative;width: 100%;height: 111px;top: 102px;border-top: 1px solid #e6e6e6;border-bottom: 1px solid #e6e6e6">
                        <span style="position: absolute;line-height: 30px;font-size: 11px;color: #333333;left: 15px;height: 30px;">常见科室</span>
                        <div class="content-block" style="position: absolute;width: 100%;height: 71px">
                            <div class="row" id="hot_department_top">
                                <div class="col-25 button section-btn" id="backgroudColor1" style="background-color: #f9e6e7"></div>
                                <div class="col-25 button section-btn" id="backgroudColor2" style="background-color: #fae4c8"></div>
                                <div class="col-25 button section-btn" id="backgroudColor3" style="background-color: #c3f4df"></div>
                                <div class="col-25 button section-btn" id="backgroudColor4" style="background-color: #ddedf4"></div>
                            </div>
                            <div class="row" id="hot_department_bottom" style="margin-top: 7px">
                                <div class="col-25 button section-btn" id="backgroudColor5" style="background-color: #d9f0f3"></div>
                                <div class="col-25 button section-btn" id="backgroudColor6" style="background-color: #f4ecf5"></div>
                                <div class="col-25 button section-btn" id="backgroudColor7" style="background-color: #f6e9e1"></div>
                                <div class="col-25 button section-btn" id="backgroudColor8" style="background-color: #dfdfdf"></div>
                            </div>
                        </div>
                    </div>
                    <!--热门医院-->
                    <div style="position: relative;width:100%;top:112px;border-top: 1px solid #e6e6e6">
                        <span style="position: absolute;line-height: 30px;font-size: 11px;color: #333333;left: 15px;height: 21px;">热门医院</span>

                        <div id="hostpital" style="margin-top: 21px;">
                        </div>

                        <div id="all_hospital" style="position: relative;margin-top: 0;width: 100%;height: 43px;color: #999999;font-size: 12px;text-align: center;line-height: 43px;border-bottom: 1px solid #e6e6e6">查看全部</div>
                        <div style="position: relative;height: 100px;width: 60%"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- Second view (for second wrap)-->
    <div id="view-2" class="view tab">
                <!-- We can make with view with navigation, let's add Top Navbar-->
        <div class="navbar">
            <div class="navbar-inner" style="background-color: #38a16d">
                <div class="center sliding" style="color: white">口碑医生</div>
            </div>
            <!--选择-->
            <div class="tabs-choose text-center" style="margin-top: 44px">
                <div id="dropdownHospital" class="icon-right2" style="border-right: 1px solid #EDEDED">全部医院</div>
                <div id="dropdownDepartment_department" class="icon-right2" style="border-right: 1px solid #EDEDED">全部科室</div>
                <div id="dropdownDepartment" class="icon-right2">综合排序</div>
            </div>
        </div>
    <div class="pages navbar-through">
        <div data-page="index-2" class="page page-on-center">
            <div class="page-content pull-to-refresh-content infinite-scroll">
                <!-- 默认的下拉刷新层 -->
                <div class="pull-to-refresh-layer">
                    <div class="preloader"></div>
                    <div class="pull-to-refresh-arrow"></div>
                </div>

                <div class="main-content">
                    <!--选择-->
                    <div class="sel-popup" style="display:none;">
                        <div id="hospitalItems" class="item-content" style="display:none;height: 280px">
                            <div class="list item-left text-center" id="hospitalList"></div>
                        </div>

                        <div id="departmentItems" class="item-content" style="display:none;">
                            <div class="text-center item-left list" id="departmentLeft">
                                <a data-name="全部职称" data-id="" class="list-item text-left list-item-p-tb15 list-item-norightborder">全部职称</a>
                                <a data-name="主任医师" data-id="43" class="list-item text-left list-item-p-tb15 list-item-norightborder">主任医师</a>
                                <a data-name="副主任医师" data-id="42" class="list-item text-left list-item-p-tb15 list-item-norightborder">副主任医师</a>
                                <a data-name="主治医师" data-id="41" class="list-item text-left list-item-p-tb15 list-item-norightborder">主治医师</a>
                                <a data-name="教授" data-id="68" class="list-item text-left list-item-p-tb15 list-item-norightborder">教授</a>
                                <a data-name="副教授" data-id="69" class="list-item text-left list-item-p-tb15 list-item-norightborder">副教授</a>
                            </div>
                        </div>

                        <div id="departmentItems_department" class="item-content" style="display:none;">
                            <div class="text-center item-left list" id="departmentLeft_department"></div>
                            <div class="text-center item-right list" id="departmentRight_department"></div>
                        </div>
                        <div class="over-popup"></div>
                    </div>
                    <!--医生列表-->
                    <div id="doctorItems"></div>

                    <!--搜索无结果-->
                    <div id="searchIcon" style="position: absolute;display: none; margin-top: 173px;width: 100%;text-align: center">
                        <img src="img/icon-girl.png" alt="小女孩" style="width: 125px;height: 61px;left: 50%"/>
                        <p style="font-size: 13px;color: #808080">没有符合条件的医生</p>
                    </div>

                    <!-- 加载提示符 -->
                    <div class="infinite-scroll-preloader">
                        <div class="preloader"></div>
                    </div>

                </div>
            </div>
        </div>
    </div>
    </div>
    <div id="view-3" class="view tab">
            <div class="pages">
            <div data-page="index-3" class="page">
            <div class="page-content">
            <div class="content-block-title">Another plain static view</div>
    <div class="content-block">
            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel commodo massa, eu adipiscing mi. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Phasellus ultricies dictum neque, non varius tortor fermentum at. Curabitur auctor cursus imperdiet. Nam molestie nisi nec est lacinia volutpat in a purus. Maecenas consectetur condimentum viverra. Donec ultricies nec sem vel condimentum. Phasellus eu tincidunt enim, sit amet convallis orci. Vestibulum quis fringilla dolor.    </p>
    <p>Mauris commodo lacus at nisl lacinia, nec facilisis erat rhoncus. Sed eget pharetra nunc. Aenean vitae vehicula massa, sed sagittis ante. Quisque luctus nec velit dictum convallis. Nulla facilisi. Ut sed erat nisi. Donec non dolor massa. Mauris malesuada dolor velit, in suscipit leo consectetur vitae. Duis tempus ligula non eros pretium condimentum. Cras sed dolor odio.</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel commodo massa, eu adipiscing mi. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Phasellus ultricies dictum neque, non varius tortor fermentum at. Curabitur auctor cursus imperdiet. Nam molestie nisi nec est lacinia volutpat in a purus. Maecenas consectetur condimentum viverra. Donec ultricies nec sem vel condimentum. Phasellus eu tincidunt enim, sit amet convallis orci. Vestibulum quis fringilla dolor.    </p>
    </div>
    </div>
    </div>
    </div>
    </div>
    <div id="view-4" class="view tab">
        <div class="pages ">
            <div data-page="index-4" class="page">
                <div class="page-content">
                     <div style="position:absolute;width: 100%;height: 164px;background-color: #43af80">
                        <img src="img/ico_ures_sj.png" alt="头像" class="user-img" id="userimg"/>
                        <p class="user-name" id="username">名称</p>
                        <img src="img/mypage_img/iconfont-shezhi.png" alt="设置" class="user-setup"/>
                        <div style="position:absolute;width: 100%;height: 38px;background-color: #3ea779;bottom: 0;">
                        <div class="row no-gutter">
                        <div id="actievement" class="col-50 user-detailInformation user-achievement" style="border-right: 1px solid #8bcaaf;">成就：0</div>
                        <div id="income" class="col-50 user-detailInformation user-income" style="">收入：0</div>
                        </div>
                        </div>
                     </div>
                    <div class="list-block" style="margin-top: 164px">
                        <ul>
                            <li id="user_center" style="background: url(img/icon_right.png) no-repeat 98% center, url(img/mypage_img/iconfont-icon.png) no-repeat 10px center transparent;background-size: 22px 22px;">个人中心</li>
                            <li id="user_family" style="background: url(img/icon_right.png) no-repeat 98% center, url(img/mypage_img/iconfont-qunzu.png) no-repeat 10px center transparent;background-size: 22px 22px;">家庭联系人</li>
                            <li id="user_orders" style="background: url(img/icon_right.png) no-repeat 98% center, url(img/mypage_img/iconfont-dingdan.png) no-repeat 10px center transparent;background-size: 22px 22px;">我的订单</li>
                            <li id="user_disMoney" style="background: url(img/icon_right.png) no-repeat 98% center, url(img/mypage_img/iconfont-money.png) no-repeat 10px center transparent;background-size: 22px 22px;">诊疗金</li>
                            <li id="user_message" style="background: url(img/icon_right.png) no-repeat 98% center, url(img/mypage_img/iconfont-xiaoxi.png) no-repeat 10px center transparent;background-size: 22px 22px;">系统消息</li>
                            <!--<li id="user_good" style="background: url(img/icon_right.png) no-repeat 98% center, url(img/mypage_img/iconfont-pingjiaguanli.png) no-repeat 10px center transparent;background-size: 22px 22px;">好评赚诊疗金</li>-->
                            <!--<li id="user_share" style="background: url(img/icon_right.png) no-repeat 98% center, url(img/mypage_img/iconfont-fenxiang.png) no-repeat 10px center transparent;background-size: 22px 22px;">分享</li>-->
                        </ul>
                    </div>

                </div>
            </div>
        </div>
    </div>

                <!-- Bottom Tabbar-->
    <div class="toolbar tabbar tabbar-labels">
            <div class="toolbar-inner">
            <a href="#view-1" class="tab-link active">
            <img src="img/icon_both_0.png" alt="首页" class="icon" style="height: 25px;width: 25px;"/>
            <span class="tabbar-label">首页</span>
            </a>
            <a href="#view-2" class="tab-link">
            <!--<i class="icon tabbar-demo-icon-2"></i>-->
            <img src="img/icon_both_1.png" alt="口碑医生" class="icon" style="height: 25px;width: 25px;"/>
            <span class="tabbar-label">口碑医生</span>
            </a>
            <a href="http://www.ekangjiuyi.com/wechat/activity/demo/" class="tab-link">
                <!--<i class="icon tabbar-demo-icon-3">-->
            <!--<span class="badge bg-red">4</span>-->
            <!--</i>-->
            <img src="img/icon_both_2.png" alt="易赚钱" class="icon" style="height: 25px;width: 25px;"/>
            <span class="tabbar-label">易赚钱</span>
            </a>
            <a href="#view-4" class="tab-link" id="click_mypage">
                <!--<i class="icon tabbar-demo-icon-4"></i>-->
                <img src="img/icon_both_3.png" alt="我的" class="icon" style="height: 25px;width: 25px;"/>
                <span class="tabbar-label">我的</span>
            </a>
            </div>
            </div>
</div>
<script type="text/javascript" src="js/framework7.min.js"></script>
<script type="text/javascript" src="js/my-app.js"></script>
<script src="js/jquery-1.10.2.js"></script>
<script src="js/ekang.js"></script>
<script src="js/jquery.cookie.js"></script>
<!--<script src="js/sousou.js"></script>-->
<script>
    $('#click_mypage').click(function () {
        if(!$.cookie("local_userId")){
           location.href = "login.html";
        }
    });
    var longitude;      //经度
    var latitude;       //纬度
    //=========== 首页  ===========
    $(function(){
        sousou_key =  getQueryString('enkey');
        var ua = navigator.userAgent.toLowerCase();
        if(ua.match(/MicroMessenger/i)=="micromessenger") {
            is_wechat = 0;
            $.cookie('is_wechat', is_wechat, { expires: 7,path: '/' });
        } else {
            is_wechat = 1;
            $.cookie('is_wechat', is_wechat, { expires: 7,path: '/' });
        }
//        enkey(sousou_key)
        /// 地理定位
        function getLocation()
        {
            if (navigator.geolocation)
            {
                navigator.geolocation.getCurrentPosition(showPosition,showError);
            }else{
                alert("现不支持定位");
                app.getDepartment_index1();
            }
        }
        function showPosition(position)
        {
            longitude = position.coords.longitude;
            latitude = position.coords.latitude;
            $.cookie('longitude', longitude, { expires: 7,path: '/' });
            $.cookie('latitude', latitude, { expires: 7,path: '/' });
            app.getDepartment_index1();
        }
        function showError(error){
            switch(error.code)
            {
                case error.PERMISSION_DENIED:
                    alert("请在设置中打开定位功能");
                    break;
                case error.POSITION_UNAVAILABLE:
                    alert("无法获取当前位置");
                    break;
                case error.TIMEOUT:
                    alert("操作超时");
                    break;
                case error.UNKNOWN_ERROR:
                    alert("An unknown error occurred.");
                    break;
            }
            app.getDepartment_index1();
        }
//            开始定位
        getLocation();

        $('#searchGo').on('click', function () {
            location.href = "searchPage.html";
        });
        var app = {
            //获取资产信息
            getDepartment_index1: function () {
                    $.ajax({
                        type: 'GET',
                        url: textUrl+'index.php/wish/index',
                        data: {
                            longitude: $.cookie("longitude"),
                            latitude: $.cookie("latitude"),
                            enkey : sousou_key
//                        longitude: "1000",
//                        latitude: "1000"
                        },
                        dataType: 'jsonp',
                        jsonp: 'callback',
                        success: function (result) {
                            if (result.ret == 0) {

                                if(result.data.uid>0){
                                    $.cookie('local_userId', result.data.uid, { expires: 7,path: '/' });
                                }
                                // 顶部按钮
                                var topArr = result.data.top;
                                var web_url = result.data.focus_pic_1[0].web_url
                                var web_url2 = result.data.center[7].web_url
                                for(var i=0;i<topArr.length;i++){
                                    var top_list = topArr[i];
                                    var items = '';
                                    items += '<td class="item-width-25">';
                                    items += '<img src="'+top_list.pic_url+'" alt="找医院" data-index="'+i+'" class="content-img" style="width:32px;height:32px;margin: 10px auto;"/>';
                                    items += '<p class="top-item-text">'+top_list.pic_text+'</p>';
                                    items += '<br/>';
                                    items += '</td>';
                                    $('#top_list_content').append(items);
                                }
                                $('#top_list_content img').on('click', function () {
                                    var currentIndex = $(this).data('index');
                                    if(currentIndex == 0){
                                        location.href = "http://ekang.ren/wechat/activity/index/"
                                    }else if(currentIndex == 1){
                                        location.href = "chooseDoctor/doctorList.html";
                                    }else if(currentIndex == 2){
//                                    location.href = "myCenter/diagnosis_money.html";
                                        location.href = "groupconsultation/groupconsultationh5.html?uid="+$.cookie("local_userId");
                                    }else if(currentIndex == 3){
                                        location.href = "near_hospital/near_hospital.html";
                                    }
                                });

                                // 常见科室
                                var hot_department = result.data.hot_department;
                                $('#backgroudColor1').html(hot_department[0].department_name);
                                $('#backgroudColor2').html(hot_department[1].department_name);
                                $('#backgroudColor3').html(hot_department[2].department_name);
                                $('#backgroudColor4').html(hot_department[3].department_name);
                                $('#backgroudColor5').html(hot_department[4].department_name);
                                $('#backgroudColor6').html(hot_department[5].department_name);
                                $('#backgroudColor7').html(hot_department[6].department_name);
                                $('#backgroudColor8').html(hot_department[7].department_name);
                                $('#backgroudColor1').click(function () {
                                    $.cookie('departmentname', hot_department[0].department_name, { expires: 7,path: '/' });
                                    location.href = "chooseDoctor/doctorList.html?departmentid="+hot_department[0].department_id;
                                });
                                $('#backgroudColor2').click(function () {
                                    $.cookie('departmentname', hot_department[1].department_name, { expires: 7,path: '/' });
                                    location.href = "chooseDoctor/doctorList.html?departmentid="+hot_department[1].department_id;
                                });
                                $('#backgroudColor3').click(function () {
                                    $.cookie('departmentname', hot_department[2].department_name, { expires: 7,path: '/' });
                                    location.href = "chooseDoctor/doctorList.html?departmentid="+hot_department[2].department_id;
                                });
                                $('#backgroudColor4').click(function () {
                                    $.cookie('departmentname', hot_department[3].department_name, { expires: 7,path: '/' });
                                    location.href = "chooseDoctor/doctorList.html?departmentid="+hot_department[3].department_id;
                                });
                                $('#backgroudColor5').click(function () {
                                    $.cookie('departmentname', hot_department[4].department_name, { expires: 7,path: '/' });
                                    location.href = "chooseDoctor/doctorList.html?departmentid="+hot_department[4].department_id;
                                });
                                $('#backgroudColor6').click(function () {
                                    $.cookie('departmentname', hot_department[5].department_name, { expires: 7,path: '/' });
                                    location.href = "chooseDoctor/doctorList.html?departmentid="+hot_department[5].department_id;
                                });
                                $('#backgroudColor7').click(function () {
                                    $.cookie('departmentname', hot_department[6].department_name, { expires: 7,path: '/' });
                                    location.href = "chooseDoctor/doctorList.html?departmentid="+hot_department[6].department_id;
                                });
                                $('#backgroudColor8').click(function () {
                                    location.href = 'chooseDoctor/forDoctors.html'
//                                $.cookie('departmentname', hot_department[7].department_name, { expires: 7,path: '/' });
//                                location.href = "chooseDoctor/doctorList.html?departmentid="+hot_department[7].department_id;
                                });

//                            for(var a=0;a<hot_department.length;a++){
//                                if(a<4){
//                                    var department_top = hot_department[a];
//                                    var items_hot_top = '';
//                                    items_hot_top += '<div class="col-25 button section-btn" id="backgroudColor" style="background-color: #f9e6e7">'+ department_top.department_name+'</div>';
//                                    $('#backgroudColor').css("backgroundColor", colorArr[a]);
//                                    $('#hot_department_top').append(items_hot_top);
//                                }
//
//                                if(a>=4){
//                                    var department_bottom = hot_department[a];
//                                    var items_hot = '';
//                                    items_hot += '<div class="col-25 button section-btn" id="backgroupColor_bottom" style="background-color: #f9e6e7">'+ department_bottom.department_name+'</div>';
//                                    $('#backgroupColor_bottom').css("backgroundColor", colorArr[a]);
//                                    $('#hot_department_bottom').append(items_hot);
//                                }
//                            }

                                //医院
                                var  centent = result.data.center;
                                var cententList_cent_4 = centent[4];
                                $('#centent-content-img-1').attr('src',cententList_cent_4.pic_url);
                                $('#centent-content-text-1').html(cententList_cent_4.pic_text);
                                $('#centent-content-img-1').click(function () { // 就医住宿
                                    location.href = "accommodation/accommodation.html";
                                });

                                var cententList_cent_5 = centent[5];
                                $('#centent-content-img-2').attr('src',cententList_cent_5.pic_url);
                                $('#centent-content-text-2').html(cententList_cent_5.pic_text);
                                $('#centent-content-img-2').click(function () {     // 国际医疗
                                    location.href = "InternationalMedical/internation_hospital.html";
                                });
                                for(var cent=0;cent<centent.length;cent++){
                                    if(cent<4){
                                        var cententList_top = centent[cent];
                                        var centent_items_top = '';
                                        centent_items_top += '<td data-id="'+cententList_top.type+'" class="item-width-25 right-border bottom-border" >';
                                        centent_items_top += '<img src="'+cententList_top.pic_url+'" alt="找医院" class="content-img"/>';
                                        centent_items_top += '<p class="content-text">'+cententList_top.pic_text+'</p>';
                                        centent_items_top += '<br/>';
                                        centent_items_top += '</td>';
                                        $('#top-centent').append(centent_items_top);
                                    }
                                    if(cent>=6){
                                        var cententList_bottom = centent[cent];
                                        var centent_items_bottom = '';
                                        centent_items_bottom += '<td data-id="'+cententList_bottom.type+'" class="item-width-25 right-border bottom-border" >';
                                        centent_items_bottom += '<img src="'+cententList_bottom.pic_url+'" alt="找医院" class="content-img"/>';
                                        centent_items_bottom += '<p class="content-text">'+cententList_bottom.pic_text+'</p>';
                                        centent_items_bottom += '<br/>';
                                        centent_items_bottom += '</td>';
                                        $('#bottom-centent').append(centent_items_bottom);
                                        weburl = cententList_bottom.web_url
                                    }
                                }

                                $('#top-centent td').on('click', function () {
                                    var currentIndex = $(this).data('id');
                                    if(currentIndex == 5){     // 找医院
                                        location.href = "hospitalInformation/hospital_type.html";
                                    }else if(currentIndex == 6){     // 床位手术
                                        location.href = "bed_surgery/bed_surgery.html";
                                    }else if(currentIndex == 8){     // 找护工
                                        if($.cookie("local_userId")){
                                            location.href = "hospital_nurse/nurse_appointment.html";
                                        }else{
                                            location.href = "login.html";
                                        }
                                    }else if(currentIndex == 14){
                                        if($.cookie("local_userId")){
                                            location.href="consultationdetails/expertconsultation.html";
                                        }else{
                                            location.href = "login.html";
                                        }
                                    }
                                });

                                $('#bottom-centent td').on('click', function () {

                                    var currentIndex = $(this).data('id');

                                    if(currentIndex == 11){     // 陪诊服务
                                        if($.cookie("local_userId")){
                                            location.href = "accompany_sever/accompany_sever.html";
                                        }else{
                                            location.href = "login.html";
                                        }
                                    }else if(currentIndex == 13){     // 体检
                                        location.href = "examination/examination.html";
                                    }else if(currentIndex == 12){     // 专车接驾
                                        location.href=web_url2
                                    }else if(currentIndex == 7){        // 我的健康
                                        location.href = "http://www.ekangjiuyi.net/EKang2.0/geneticTesting/index.html";
                                    }
                                });

                                // 轮播图
                                var focus_pic_1 = result.data.focus_pic_1;
                                for(var c=0;c<focus_pic_1.length;c++){
                                    var focus_pic_list_1 = focus_pic_1[c];
                                    var foucs_items_1 = '';
                                    foucs_items_1 += '<img src="'+focus_pic_list_1.pic_url+'" alt="贵宾专区">';

                                    $('#bannerImg_1').append(foucs_items_1);
                                    //$('#bannerImage img').css('float')
                                }

                                //轮播图动画
                                img_l = $('#bannerImg_1 img').length
                                $('.table .auto_content_wrap_table').width(img_l*100+'%');
                                $('#bannerImg_1 img').width(100/img_l+'%');
                                img_W = $('#bannerImg_1 img').width();
                                if(img_l!=1){
                                    time = setInterval(function(){
                                        $('#bannerImg_1').animate({'left':-img_W},500,function(){
                                            $(this).children().first().appendTo($(this))
                                            $(this).css('left',0)
                                        })
                                    },3000)
                                    scrolbody($(".table"));
                                }
                                //滑动
                                function scrolbody(obj){
                                    var x,x2=0
                                    obj.get(0).addEventListener('touchstart',function(e){
                                        x=e.touches[0].pageX;
                                        x2=x
                                    },false);
                                    obj.get(0).addEventListener('touchmove',function(e){
                                        e.preventDefault();
                                        x2=e.touches[0].pageX;
                                    },false)
                                    obj.get(0).addEventListener('touchend',function(e){
                                        if(x-x2>10){
                                            $('#bannerImg_1').not(':animated').animate({'left':-img_W},500,function(){
                                                $(this).children().first().appendTo('#bannerImg_1')
                                                $(this).css('left',0)
                                            })
                                        }else if(x2-x>10) {
                                            $('#bannerImg_1').children().last().prependTo('#bannerImg_1')
                                            $('#bannerImg_1').css('left',-img_W)
                                            $('#bannerImg_1').not(':animated').animate({'left':0},500)
                                        }
                                    },false);
                                }

                                $('#bannerImg_1 img').click(function () {
                                    if($.cookie("local_userId")){
                                        location.href = web_url;
                                    }else{
                                        location.href = 'login.html'
                                    }

                                });

                                // 轮播图
                                var focus_pic_2 = result.data.focus_pic_2;
                                for(var d=0;d<focus_pic_2.length;d++){
                                    var focus_pic_list = focus_pic_2[d];
                                    var foucsitems = '';
                                    foucsitems += '<img data-id="'+d+'" src="'+focus_pic_list.pic_url+'" alt="banner">';
                                    $('#bannerImage').append(foucsitems);
                                    if(focus_pic_2.length == 1){
                                        $('#bannerIcon').hide();
                                    }else{
                                        var foucs_icon = '';
                                        foucs_icon += '<span></span>';
                                        $('#bannerIcon').html(foucs_icon);

                                    }
                                }
                                //轮播图动画
                                img_l2 = $('#bannerImage img').length
                                $('.auto_content_wrap').width(img_l2*100+'%');
                                $('#bannerImage img').width(100/img_l2+'%');
                                img_W2 = $('#bannerImage img').width();
                                if(img_l2!=1){
                                    time = setInterval(function(){
                                        $('#bannerImage').animate({'left':-img_W2},500,function(){
                                            $(this).children().first().appendTo($(this))
                                            $(this).css('left',0)
                                        })
                                    },3000);
                                    scrolbody2($(".autoplay_news"));
                                }
                                //滑动
                                function scrolbody2(obj2){
                                    var x,x2=0
                                    obj2.get(0).addEventListener('touchstart',function(e){
                                        x=e.touches[0].pageX;
                                        x2=x
                                    },false);
                                    obj2.get(0).addEventListener('touchmove',function(e){
                                        e.preventDefault();
                                        x2=e.touches[0].pageX;
                                    },false)
                                    obj2.get(0).addEventListener('touchend',function(e){
                                        if(x-x2>10){
                                            $('#bannerImage').not(':animated').animate({'left':-img_W2},500,function(){
                                                $(this).children().first().appendTo('#bannerImage')
                                                $(this).css('left',0)
                                            })
                                        }else if(x2-x>10) {
                                            $('#bannerImage').children().last().prependTo('#bannerImage')
                                            $('#bannerImage').css('left',-img_W2)
                                            $('#bannerImage').not(':animated').animate({'left':0},500)
                                        }
                                    },false);
                                }
//                            var Main = {	iscrolls : []};
//                            Main.get(textUrl+'index.php/wish/index',function(res){
//                                if(res.err==0){
//                                    res.data
//                                }else if(res.err==2){
//                                    alert(res.msg);
//                                }
//                            })

                                $.ajax({
                                    type : 'get',
                                    url : textUrl+'index.php/wish/index',
                                    dataType : 'jsonp',
                                    data : {
                                        longitude: $.cookie("longitude"),
                                        latitude: $.cookie("latitude")
                                    },
                                    success : function(res) {
                                        console.log(res);
                                        if(res.ret==0){
                                            ban_url = res.data.focus_pic_2[0].web_url
                                            $('#bannerImage img').click(function(){
                                                //alert($(this).attr(('data_id')))
                                                var data_id = $(this).attr('data-id');
                                                location.href = res.data.focus_pic_2[data_id].web_url
                                            })
                                        }else{
                                            alert(res.msg)
                                        }

                                    }
                                });
                                // 热门医院
                                var hot_hospital_arr = result.data.hot_hospital;
                                for(var j=0;j<hot_hospital_arr.length;j++){
                                    var hospitalList = hot_hospital_arr[j];
                                    var hospitalItems = '';
                                    hospitalItems += '<div data-id="'+ hospitalList.id+'" onclick="hospitalDetail($(this))" style="position:relative;width: 100%;height: 61px;border-bottom: 1px solid #e6e6e6">';
                                    hospitalItems += '<img src="'+hospitalList.pic+'" alt="头像" class="left-box" style="position: absolute;width: 40px;height: 40px;border-radius: 4px;top:10px"/>';
                                    hospitalItems += '<div style="position: absolute;font-size: 14px;color: #333333;top: 11px;left: 56px; width: 80%" class="message">'+hospitalList.hospital_name+'&nbsp&nbsp<span style="position: absolute;width: 33px;height: 16px;line-height:16px;font-size: 12px;background-color: #f95e64;color: white;text-align: center;border-radius: 2px">'+hospitalList.type_text+'</span></div>';
                                    hospitalItems += '<span style="position: absolute;font-size: 12px;color: #808080;top: 31px;left: 56px" class="message">'+hospitalList.direction+'</span>';
                                    hospitalItems += '<span class="message" style="position: absolute;text-align: right;font-size: 12px;color: #808080;right: 15px;top: 30px;background: url(img/icon_position.png) no-repeat right center transparent; background-size: 9px 13px;background-position: 0 0;">&nbsp&nbsp&nbsp&nbsp&nbsp'+hospitalList.distance+'</span>';
                                    hospitalItems += '</div>';

                                    $('#hostpital').append(hospitalItems);
                                }
                            }
                        }
                    });
            }
        };
//        app.getDepartment_index1();

        $('#callPhone').click(function () {
            location.href = "tel://4006305060";
        })

        $('#all_hospital').click(function () {
            location.href = "hospitalInformation/hospital_type.html";
        });

        // 列表---轮播图
        function autoPlayImg_table(autoWrap){
            var $playCon=autoWrap.children(".auto_con_table");
            var $playIco=autoWrap.siblings(".auto_tab_table").find("span");
            var $playInfo=autoWrap.siblings(".auto_info_table").find("li");
//            $playIco.eq(0).addClass("curr_table");
            $playCon.eq(0).addClass('curr_con_table');
            $playInfo.eq(0).show();
            var i=0;
            var iNow=0;
            for(i=0; i<$playIco.length; i++){
                $playIco[i].index=i;
                $playIco[i].onclick=function(){
                    clearInterval(timer);
                    if(iNow==this.index){
                        return;
                    }
                    iNow=this.index;
                    tab_play();
                    timer=setInterval(turnNext,3000);
                }
            }
            function tab_play(){
                for(i=0; i<$playIco.length; i++){
//                    $playIco.removeClass("curr_table");
                    $playCon.stop().animate({opacity:0},600).removeClass('curr_con_table');
                    $playInfo.hide();
                }
                $playIco.eq(iNow).addClass("curr");
                $playCon.eq(iNow).stop().animate({opacity:1},600).addClass('curr_con_table');
                $playInfo.eq(iNow).show();
            }
            function turnNext(){
                iNow++;
                if(iNow>=$playIco.length){
                    iNow=0;
                }
                tab_play();
            }
            var timer=setInterval(turnNext,3000);
        }
//          自动播放
        var $autoWrap_tab=$(".auto_content_wrap_table");
        autoPlayImg_table($autoWrap_tab);
        //轮播图
        function autoPlayImg(autoWrap){
            var $playCon=autoWrap.children(".auto_con");
            var $playIco=autoWrap.siblings(".auto_tab").find("span");
            var $playInfo=autoWrap.siblings(".auto_info").find("li");
            $playIco.eq(0).addClass("curr");
            $playCon.eq(0).addClass('curr_con');
            $playInfo.eq(0).show();
            var i=0;
            var iNow=0;
            for(i=0; i<$playIco.length; i++){
                $playIco[i].index=i;
                $playIco[i].onclick=function(){
                    clearInterval(timer);
                    if(iNow==this.index){
                        return;
                    }
                    iNow=this.index;
                    tab_play();
                    timer=setInterval(turnNext,3000);
                }
            }
            function tab_play(){
                for(i=0; i<$playIco.length; i++){
                    $playIco.removeClass("curr");
                    $playCon.stop().animate({opacity:0},600).removeClass('curr_con');
                    $playInfo.hide();
                }
                $playIco.eq(iNow).addClass("curr");
                $playCon.eq(iNow).stop().animate({opacity:1},600).addClass('curr_con');
                $playInfo.eq(iNow).show();
            }
            function turnNext(){
                iNow++;
                if(iNow>=$playIco.length){
                    iNow=0;
                }
                tab_play();
            }
            var timer=setInterval(turnNext,3000);
        }
        //自动播放
        var $autoWrap=$(".auto_content_wrap");
        autoPlayImg($autoWrap);
    });

    function hospitalDetail(o){
        var id = o.data("id");

        location.href = "hospitalInformation/hospitalDetail.html?type=1&hospitalId="+id;
    }


    //=========== 口碑医生  =============
    $(function () {
        var     $hospitalItems = $('#hospitalItems'),
                $departmentItems = $('#departmentItems'),
                $departmentItems_department = $('#departmentItems_department');
                childNodes = [], //地区
                departmentNodes = [],  // 科室

                pageIndex = 1;// 页码

                city_code = '';     // 城市id
                hospital_ID = '';   // 医院id
                department_id = ''; // 科室id

        var option = {
            // 获取医院列表
            getHospital: function(){
                $.ajax({
                    type: 'GET',
                    url: textUrl +'/hospital/hospitalList',
                    data: {
                        page_size: '500',
                        page_index: 1,
                        sid: '',
                    },
                    dataType: 'jsonp',
                    jsonp: 'callback',
                    success: function (result) {
                        if (result.ret == 0) {
                            var item = '';
                            $.each(result.data, function (i, o) {
                                item += '<a class="list-item " data-id="' + o.id + '" data-name="'+ o.name+'" style="text-align: left">' + o.name + '</a>';
                            });
                            $('#hospitalList').html(item);

                            $hospitalItems.find('a').on('click', function () {
                                hospital_ID = $(this).data('id');
                                hospital_name = $(this).data('name');
                                $('#dropdownHospital').html(hospital_name);
                                $('#dropdownHospital').click();
                                option.getDoctorList();
                            });
                        }
                    }
                });
            },

            // 获取科室
            getDepartmentList:function () {
                $.ajax({
                    type: 'GET',
                    url: textUrl+'/hospital/department',
                    data: {
                        hospital_id: hospital_ID,
                        page_size: '500',
                        page_index: 1,
                        sid: '',
                    },
                    dataType: 'jsonp',
                    jsonp: 'callback',
                    success: function (result) {
                        $('#departmentRight_department').html('');
                        if (result.ret == 0) {
                            var itemLeft = '';
                            departmentNodes = [];

                            $.each(result.data, function (i, o) {
                                var data = o;

                                departmentNodes.push(o.child_department);

                                itemLeft += '<a class="list-item text-left list-item-p-tb15 list-item-norightborder" data-id="' + data.id + '" data-index="' + i + '">' + data.name + '</a>';
                            });
                            $('#departmentLeft_department').html(itemLeft);

                            $('#departmentLeft_department a').on('click', function () {
                                $('.item-active').removeClass('item-active');
                                $(this).addClass('item-active');
                                var currentIndex = $(this).data('index');
                                option.getdepartment(currentIndex);
                            });
                        }
                    }
                });
            },
            // 获取子科室
            getdepartment: function (index){
                var item = '';
                $.each(departmentNodes[index], function (i, data) {
                    item += '<a class="list-item list-item-noborder text-left list-item-p-tb15" data-id="' + data.id + '" data-name="'+data.name+'">' + data.name + '</a>';
                });
                $('#departmentRight_department').html(item);

                $('#departmentRight_department a').on('click', function () {
                    $('#dropdownDepartment_department').removeClass('icon-down2').addClass('icon-right2');
                    $departmentItems_department.hide();
                    $('.sel-popup').hide();
                    $('#doctorItems').html('');

                    // 请求医生
                    department_id = $(this).data('id');
                    department_name = $(this).data('name');
                    $('#dropdownDepartment_department').html(department_name);
                    option.getDoctorList();

                });
            },

            // 获取城市区域
            getDepartment: function () {
                $.ajax({
                    type: 'GET',
                    url: textUrl+'/location/getProvinceList/',
                    data: {
                        page_size: '500',
                        page_index: 1,
                        sid: '',
                    },
                    dataType: 'jsonp',
                    jsonp: 'callback',
                    success: function (result) {
                        $('#departmentRight').html('');
                        if (result.ret == 0) {
                            var itemLeft = '';
                            childNodes = [];

                            $.each(result.data, function (i, o) {
                                var data = o;

                                childNodes.push(o.city_list);

                                itemLeft += '<a class="list-item text-left list-item-p-tb15 list-item-norightborder" data-id="' + data.id + '" data-index="' + i + '">' + data.name + '</a>';
                            });
                            $('#departmentLeft').html(itemLeft);

                            $('#departmentLeft a').on('click', function () {
                                $('.item-active').removeClass('item-active');
                                $(this).addClass('item-active');
                                province_ID = $(this).data('index');
                                var currentIndex = $(this).data('index');
                                option.getChildDepart(currentIndex);
                            });
                        }
                    }
                });
            },

            // 获取子城市
            getChildDepart: function (index) {
                var item = '';
                $.each(childNodes[index], function (i, data) {
                    item += '<a class="list-item list-item-noborder text-left list-item-p-tb15" data-id="' + data.code + '" data-name="'+data.name+'">' + data.name + '</a>';
                });
                $('#departmentRight').html(item);

                $('#departmentRight a').on('click', function () {
                    $('#dropdownDepartment').removeClass('icon-down2').addClass('icon-right2');
                    $departmentItems.hide();
                    $('.sel-popup').hide();
                    $('#doctorItems').html('');
                    pageIndex = 1;

                    // 请求医生列表
                    city_code = $(this).data('id');
                    city_name = $(this).data('name');
                    $('#dropdownDepartment').html(city_name);
                    option.getDoctorList();

                });
            },

            // 获取医生列表
            getDoctorList: function () {
                $.ajax({
                    type: 'GET',
                    url: textUrl+'/doctor/doctorIndex',
                    data: {
                        job_id: city_code,
                        hospital_id: hospital_ID,
                        department_id: department_id,
                        page_size: 20,
                        page_index: pageIndex
                    },
                    dataType: 'jsonp',
                    jsonp: 'callback',
                    success: function (result) {
                        if (result.ret == 0) {
                            if(result.data.length == 0){
                                $('#searchIcon').show();
                            }else{
                                $('#searchIcon').hide();
                            }

//                            alert("医院：" + hospital_ID + "科室：" +department_id+ "城市："+city_code);

                            var item = '';
                            $.each(result.data, function (i, o) {
                                var taginfo = '';
                                $.each(o.tag_info, function (j, t) {
                                    taginfo += t.tag_name + ' ';
                                });

                                var paramObj = new Object();
                                paramObj.doctorId = o.doctor_id;
                                paramObj.uid = o.uid;
                                paramObj.userName = o.user_name;
                                paramObj.headPic = o.avatar_file;
                                paramObj.hospitalName = o.hospital_name;
                                paramObj.jobName = o.job_name;
                                paramObj.departmentName = o.department_name;
                                paramObj.tagInfo = taginfo;

                                item+= '<div class="docterDetail" onclick="docterDetail('+o.doctor_id+')" style="position: relative;height: 60px;width: 100%;background-color: white;border-bottom: 1px solid #e6e6e6">';
                                item+= '<img src="' + o.avatar_file + '" alt="头像" class="top-user-img"/>';
                                item+= '<span class="message top-user-name">' + o.user_name +'</span>';
                                item+= '<span class="message top-user-name" style="left: 111px;top: 13px;font-size: 11px;color: #808080">' + o.job_name + '</span>';
                                item+= '<span class="message top-user-detail">' + o.hospital_name + ' &nbsp;' + o.department_name + '</span>';
                                item+= '<div class="top-user-recommended">';
                                item+= '<span class="recommend">'+ o.rec_index +'%</span>';
                                item+= '<span class="recommend1 message">推荐</span>';
                                item+= '</div>';
                                item+= '</div>';
                            });

                            // 前插新列表元素
//                            ptrContent.find('#doctorItems').html(item);
                            // 加载完毕需要重置
                            myApp.pullToRefreshDone();

                            // 加载数据
                            // 重置加载flag
                            loading = false;
                            if (lastIndex >= maxItems) {
                                // 加载完毕，则注销无限加载事件，以防不必要的加载
                                myApp.detachInfiniteScroll($('.infinite-scroll'));
                                // 删除加载提示符
                                $('.infinite-scroll-preloader').remove();
                                return;
                            }
                            // 如果正在加载，则退出
                            if (pageIndex >1 ){
                                // 添加新条目
                                $('#doctorItems').append(item);
                            }else{
                                $('#doctorItems').html(item);
                            }



                            // 更新最后加载的序号
                            lastIndex = $('#doctorItems').length;

                            if(result.data.length <= 20){
                                $('.infinite-scroll-preloader').hide();
                            }else{
                                $('.infinite-scroll-preloader').show();
                            }

                        }else{

                        }
                    }
                });
            }
        };

        $('#departmentLeft a').on('click', function () {
            $('#dropdownDepartment').removeClass('icon-down2').addClass('icon-right2');
            $departmentItems.hide();
            $('.sel-popup').hide();
            $('#doctorItems').html('');
            pageIndex = 1;

            // 请求医生列表
            city_code = $(this).data('id');
            city_name = $(this).data('name');
            $('#dropdownDepartment').html(city_name);
            option.getDoctorList();
        });

        // 医院
        $('#dropdownHospital').on('click', function () {
            //禁用滚动条
//            $('body').addClass('disabled-scroll');

            $('#dropdownDepartment').removeClass('icon-down2').addClass('icon-right2');
            $('#dropdownDepartment_department').removeClass('icon-down2').addClass('icon-right2');
            $departmentItems.hide();
            $departmentItems_department.hide();

            if (!$hospitalItems.is(':visible')) {
                $(this).removeClass('icon-right2').addClass('icon-down2');
                $hospitalItems.show();
                $('.sel-popup').show();
            }
            else {
                $(this).removeClass('icon-down2').addClass('icon-right2');
                $hospitalItems.hide();
                $('.sel-popup').hide();
            }

        });

        // 城市
        $('#dropdownDepartment').on('click', function () {
            $('#dropdownHospital').removeClass('icon-down2').addClass('icon-right2');
            $('#dropdownDepartment_department').removeClass('icon-down2').addClass('icon-right2');
            $hospitalItems.hide();
            $departmentItems_department.hide();

            if (!$departmentItems.is(':visible')) {
                $(this).removeClass('icon-right2').addClass('icon-down2');
                $departmentItems.show();
                $('.sel-popup').show();
            }
            else {
                $(this).removeClass('icon-down2').addClass('icon-right2');
                $departmentItems.hide();
                $('.sel-popup').hide();
            }
        });

        // 科室
        $('#dropdownDepartment_department').on('click', function () {
            // 获取科室
            option.getDepartmentList();

            $('#dropdownHospital').removeClass('icon-down2').addClass('icon-right2');
            $('#dropdownDepartment').removeClass('icon-down2').addClass('icon-right2');
            $hospitalItems.hide();
            $departmentItems.hide();
            if (!$departmentItems_department.is(':visible')) {
                $(this).removeClass('icon-right2').addClass('icon-down2');
                $departmentItems_department.show();
                $('.sel-popup').show();
            }
            else {
                $(this).removeClass('icon-down2').addClass('icon-right2');
                $departmentItems_department.hide();
                $('.sel-popup').hide();
            }
        });

        $('.over-popup').on('click', function () {
            $('#dropdownHospital,#dropdownDepartment,#dropdownDepartment_department').removeClass('icon-down2').addClass('icon-right2');
            $hospitalItems.hide();
            $departmentItems.hide();
            $departmentItems_department.hide();
            $('.sel-popup').hide();
        });

        // 获取医院列表
        option.getHospital();

        // 初始化医生列表
        option.getDoctorList();

        $('#back').on('click', function () {
            location.href = "../index.html";
        });

        // 刷新
        var myApp = new Framework7();
        var $$ = Dom7;
        // 下拉刷新页面
        var ptrContent = $$('.pull-to-refresh-content');
        // 添加'refresh'监听器
        ptrContent.on('refresh', function (e) {
//            city_code = '';     // 城市id
//            hospital_ID = '';   // 医院id
//            department_id = ''; // 科室id
//            $('#dropdownDepartment_department').html("科室");
//            $('#dropdownHospital').html("全部医院");
//            $('#dropdownDepartment').html("北京");
            pageIndex=1;
            option.getDoctorList();
        });

        // 加载数据
        var loading = false;
        // 上次加载的序号
        var lastIndex = $('#doctorItems').length;
        // 最多可加载的条目
        var maxItems = 20;
        // 注册'infinite'事件处理函数
        $$('.infinite-scroll').on('infinite', function () {
            // 如果正在加载，则退出
            if (loading) return;
            // 设置flag
            loading = true;
            pageIndex++;
            option.getDoctorList();
        });
    });

    function docterDetail(id){
        location.href = "chooseDoctor/docterDetail.html?docterId="+id;
    }


    //=========== 我的  ===========
    $(function () {

        var userimg;
        var username;
        var userPhone;


        var myPage = {
            //
            getMypage: function () {

                $.ajax({
                    type: 'GET',
                    url: textUrl+'/user/getNewUserinfo',
                    data: {
                        uid:$.cookie("local_userId")
                    },
                    dataType: 'jsonp',
                    jsonp: 'callback',
                    success: function (result) {
                        if (result.ret == 0) {

                            var data = result.data;
                            userimg = data.avatar_file;

                            username = data.user_name;
                            userPhone = data.mobile;
                            $('#userimg').attr('src',data.avatar_file);
                            $('#username').html(data.user_name);
                            $('#actievement').html('成就：'+data.reputation);
                            $('#income').html('收入：'+data.money);
                        }
                    }
                });
            }
        };

        $('#userimg').on('click', function () {
            $.cookie('index_username', username, { expires: 7,path: '/' });
            location.href = "myCenter/Individual_center.html?user_img="+userimg+"&user_phone="+userPhone+"";
        });

        $('#user_center').click(function () {
            $.cookie('index_username', username, { expires: 7,path: '/' });
            location.href = "myCenter/Individual_center.html?user_img="+userimg+"&user_phone="+userPhone+"";
        });

        $('#user_family').click(function () {
            location.href = "addPeople/contactPeople.html?type=1000";
        });

        $('#user_orders').click(function () {
//            location.href = "myCenter/mycenter_orderList.html";
            location.href= 'groupconsultation/order_stay.html';
        });

        $('#user_disMoney').click(function () {
            location.href = "myCenter/diagnosis_money.html";
        });

        $('#user_message').click(function () {
            location.href = "myCenter/mycenter_message.html";
        });

        $('#user_good').click(function () {
            location.href = "#";
        });

        $('#user_share').click(function () {
            location.href = "#";
        });

        $('.user-setup').click(function () {
            location.href = "myCenter/mycenter_setUp.html?phone="+userPhone;
        });

        myPage.getMypage();
    });
</script>
<script>
    //底部选项卡切换
    $(function(){
        $('.toolbar-inner a').children('img').eq(0).attr('src','img/icon_bot_0.png')
        $('.toolbar-inner a').click(function(){
            var index = $(this).index()
            var aL = $('.toolbar-inner a').length;
            for(var i= 0;i<aL;i++){
                $('.toolbar-inner a').children('img').eq(i).attr('src','img/icon_both_'+i+'.png')
            }
            $(this).children('img').attr('src','img/icon_bot_'+index+'.png')
        })
    })
</script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js" type="text/javascript"></script>
<script src="js/weixin2.js"></script>
</body>
</html>